<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  
  <head>
    <title>积分管理</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <style>
  	.my-pic {
  		display: block;
  		width: 132px;
  		height: 132px;
  	}
  	.my-pic img{
  		display: block;
  		width: 100%;
  		height: 100%;
  	}
  	.my-span {
  		display: block;
  		margin-top: 10px;
  	}
  </style>
  <body>
    <div class="x-body">
        <form class="layui-form" id="myForm">
          <div class="layui-form-item">
              <label for="fenMoney" class="layui-form-label">
                  	消费金额:
              </label>
              <div class="layui-input-inline">
                 <input type="text" id="fenMoney" name="fenMoney"  required="" lay-verify="number"
                  autocomplete="off" class="layui-input" value="${f.fenMoney}">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="fenNumber" class="layui-form-label">
                  	获得积分:
              </label>
              <div class="layui-input-inline">
                 <input type="text" id="fenNumber" name="fenNumber"  required="" lay-verify="number"
                  autocomplete="off" class="layui-input" value="${f.fenNumber}">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="fenDetail" class="layui-form-label">
                  	积分描述:
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="fenDetail" name="fenDetail" required="" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${f.fenDetail}">
              </div>
          </div>
      
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              	<input type="hidden" name="id" value="${f.id}">
              </label>
             <div class="layui-input-inline">
                  <button class="layui-btn" id="my_add">增加</button>
              </div>
          </div>
      </form>
    </div>
    <script type="text/javascript">
    $('#my_add').click(function(){
    	var myform =$('#myForm');
        var fenMoney=$('#fenMoney').val();
        var fenNumber =$('#fenNumber').val();
        if(!(/^\d+(\.\d+)?$/.test(fenMoney))){
        	layer.msg('必填输入数字!');
         	return false;
        }
         if(!(/^[0-9]*[1-9][0-9]*$/.test(fenNumber))){
         	layer.msg('必填输入正整数!');
         	return false;
         }
     var url ="/admin/saveJifen";
    	  $.post(url,myform.serialize(),
                  function (data) {
                      if('ok'==data){
                     	 parent.location.reload();
                          x_admin_close();
                      }else{
                    	  layer.msg('操作失误!');
                      }
                  }
              );
         return false;
    })
	</script>
  </body>
</html>